package com.itheima.demo4;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalDemo4 {
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("0.3");
        BigDecimal bd2 = new BigDecimal("4");

        BigDecimal divide = bd1.divide(bd2);
        // 进一法
        BigDecimal divide1 = bd1.divide(bd2, 2, RoundingMode.UP);
        // 去尾法
        BigDecimal divide2  = bd1.divide(bd2, 2, RoundingMode.FLOOR);
        // 四舍五入
        BigDecimal divide3  = bd1.divide(bd2, 2, RoundingMode.HALF_UP);

        System.out.println(divide);
        System.out.println(divide1);
        System.out.println(divide2);
        System.out.println(divide3);
    }
}
